﻿using System;
using System.Collections.Generic;
using System.Text;
using YouHP.Utility;
using YouHP.BLL;
using System.Web;
using YouHP.Model;

namespace YouHP.Pages.User
{
    public class CommentReplyList : YouHP.Pages.User.UserBasePage
    {
        protected List<CommentInfo> CommentReplyDataList;
        protected int PageIndex;
        protected int PageSize = 20;
        protected int DataCount;
        protected int PageCount;
        protected string PagingString;


        protected override void ShowPage()
        {
            base.ShowPage();
            if (ErrorCount > 0) return;
            HandleCommon();
            if (ErrorCount > 0) return;
            if (IsPost) HandlePost();
            else
                HandleGet();
        }

        private void HandlePost()
        {
        }

        private void HandleCommon()
        {
            this.AddLocation("留言回复列表", "/User/CommentReplyList.aspx");
            this.SetTitle(this.UserData.UserName + "  的留言回复");

            this.AddScriptSrc("/support/Alpha/Js/mootools.js");

            //将留言回复设置为已读
            CommentBLL.Instance.UpdateCommentState(UserData.Id, 1,1);

        }


        protected void HandleGet()
        {
            PageIndex = RequestTools.GetQueryInt("page", 1);
            CommentReplyDataList = CommentBLL.Instance.GetCommentReplyList(PageSize, PageIndex, UserData.Id, out DataCount);
            PageCount = Utils.GetPageCount(DataCount, PageSize);

            string query = HttpContext.Current.Request.Url.Query;
            query = Utils.RemoveQueryItem(query, "page");
            PagingString = this.GetPagingString(PageIndex, PageCount,"/User/CommentReplyList.aspx" + query, "page");


        }


    }
}
